home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / A86V402.ZIP / A08.DOC < prev    next >
Text File  |  1994-12-21  |  26KB  |  661 lines

  1. CHAPTER 8   NUMBERS AND EXPRESSIONS
  2.  
  3.  
  4. Numbers and Bases
  5.  
  6. A86 supports a variety of formats for numbers.  In non-computer
  7. life, we write numbers in a decimal format.  There are ten
  8. digits, 0 through 9, that we use to describe numbers; and each
  9. digit position is ten times as significant as the position to its
  10. right.   The number ten is called the "base" of the decimal
  11. format.  Computer programmers often find it convenient to use
  12. other bases to specify numbers used in their programs.  The most
  13. commonly-used bases are two (binary format), sixteen (hexadecimal
  14. format), and eight (octal format).
  15.  
  16. The hexadecimal format requires sixteen digits.  The extra six
  17. digits beyond 0 through 9 are denoted by the first six letters of
  18. the alphabet: A for ten, B for eleven, C for twelve, D for
  19. thirteen, E for fourteen, and F for fifteen.
  20.  
  21. In A86, a number must always begin with a digit from 0 through 9,
  22. even if the base is hexadecimal.  This is so that A86 can
  23. distinguish between a number and a symbol that happens to have
  24. digits in its name.  If a hexadecimal number would begin with a
  25. letter, you precede the letter with a zero.  For example, hex A0,
  26. which is the same as decimal 160, would be written 0A0.
  27.  
  28. Because it is necessary for you to append leading zeroes to many
  29. hex numbers, and because you never have to do so for decimal
  30. numbers, I decided to make hexadecimal the default base for
  31. numbers with leading zeroes.  Decimal is still the default base
  32. for numbers beginning with 1 through 9.
  33.  
  34. Large numbers can be given as the operands to DD, DQ, or DT
  35. directives.  For readability, you may freely intersperse
  36. underscore characters anywhere with your numbers.
  37.  
  38. The default base can be overridden, with a letter or letters at
  39. the end of the number: B or xB for binary, O or Q for octal, H
  40. for hexadecimal, and D or xD for decimal.  Examples:
  41.  
  42.  077Q       octal, value is 8*7 + 7 = 63 in decimal notation
  43.  123O       octal if the "O" is a letter: 64 + 2*8 + 3 = 83 decimal
  44.  1230       decimal 1230: shows why you should use "Q" for octal!!
  45.  01234567H  large constant
  46.  0001_0000_0000_0000_0003R          real number specified in hexadecimal
  47.  100D       superfluous D indicates decimal base
  48.  0100D      hex number 100D, which is 4096 + 13 = 5009 in decimal
  49.  0100xD     decimal 100, since xD overrides the default hex format
  50.  0110B      hex 110B, which is 4096 + 256 + 11 = 4363 in decimal
  51.  0110xB     binary 4+2 = 6 in decimal notation
  52.  110B       also binary 4+2 = 6, since "B" is not a decimal digit
  53.                                                               8-2
  54.  
  55. The last five examples above illustrate why an "x" is sometimes
  56. necessary before the base-override letter "B" or "D".  If that
  57. letter can be interpreted as a hex digit, it is; the "x" forces
  58. an override interpretation for the "B" or "D".  By the way, the
  59. usage of lower case for x and upper case for the following
  60. override letter is simply a recommendation; A86 treats upper-and
  61. lower-case letters equivalently.
  62.  
  63. A86 also accepts a "base" of K.  The number preceding the K is
  64. interpreted as a decimal number which is multplied by 1024.
  65. Thus, 2K is 2048, 16K is 16384, etc.
  66.  
  67.  
  68. The RADIX Directive
  69.  
  70. The above-mentioned set of defaults (hex if leading zero, decimal
  71. otherwise) can be overridden with the RADIX (or, for
  72. compatibility, .RADIX) directive.  The RADIX directive consists
  73. of the word RADIX followed by a number from 2 to 16.  The default
  74. base for the number is ALWAYS decimal, regardless of any (or no)
  75. previous RADIX commands.  The number gives the default base for
  76. ALL subsequent numbers, up to (but not including) the next RADIX
  77. command.  If there is no number following RADIX, then A86 returns
  78. to its initial mixed default of hex for leading zeroes, decimal
  79. for other leading digits.
  80.  
  81. As an alternative to the RADIX directive, I provide the D switch,
  82. which causes A86 to start with decimal defaults.  You can put +D
  83. into the A86 command invocation, or into the A86 environment
  84. variable.  The first RADIX command in the program will override
  85. the D switch setting.
  86.  
  87. Following are examples of radix usage.  The numbers in the
  88. comments are all in decimal notation.
  89.  
  90.   DB 10,010     ; produces 10,16 if RADIX was not seen yet
  91.                 ;   and +D switch was not specified
  92. RADIX 10
  93.   DB 10,010     ; produces 10,10
  94. RADIX 16
  95.   DB 10,010     ; produces 16,16
  96. RADIX 3         ; for Martian programmers in Heinlein novels
  97.   DB 10,100     ; produces 3,9
  98. RADIX
  99.   DB 10,010     ; produces 10,16
  100.                                                               8-3
  101.  
  102. Floating Point Initializations
  103.  
  104. A86 allows floating point numbers as the operands to DD, DQ, and
  105. DT directives.  The numbers are encoded according to the IEEE
  106. standard, followed by the 8087 and 287 coprocessors.  The format
  107. for floating point constants is as follows: First, there is a
  108. decimal number containing a decimal point.  There must be a
  109. decimal point, or else the number is interpreted as an integer.
  110. There must also be at least one decimal digit, either to the left
  111. or right of the decimal point, or else the decimal point is
  112. interpreted as an addition (structure element) operator.
  113. Optionally, there may follow immediately after the decimal number
  114. the letter E followed by a decimal number.  The E stands for
  115. "exponent", and means "times 10 raised to the power of".  You may
  116. provide a + or - between the E and its number.  Examples:
  117.  
  118.   0.1             constant one-tenth
  119.   .1              the same
  120.   300.            floating point three hundred
  121.   30.E1           30 * 10**1; i.e., three hundred
  122.   30.E+1          the same
  123.   30.E-1          30 * 10**-1; i.e., three
  124.   30E1            not floating point: hex integer 030E1
  125.   1.234E20        scientific notation: 1.234 times 10 to the 20th
  126.   1.234E-20       a tiny number: 1.234 divided by 10 to the 20th
  127.  
  128.  
  129.  
  130. Overview of Expressions
  131.  
  132. Most of the operands that you code into your instructions and
  133. data initializations will be simple register names, variable
  134. names, or constants.  However, you will regularly wish to code
  135. operands that are the results of arithmetic calculations,
  136. performed either by the machine when the program is running (for
  137. indexing), or by the assembler (to determine the value to
  138. assemble into the program).  A86 has a full set of operators that
  139. you can use to create expressions to cover these cases.  They are
  140. given in the "Descriptions of Operators and Specifiers" section
  141. later in this chapter.
  142.  
  143.  
  144. Types of Expression Operands
  145.  
  146. Numbers and Label Addresses
  147.  
  148. A number or constant (16-bit number) can be used in most
  149. expressions.   A label (defined with a colon) is also treated as
  150. a constant and so can be used in expressions.
  151.  
  152. Variables
  153.  
  154. A variable stands for a byte- or word-memory location.   You may
  155. add or subtract constants from variables; when you do so, the
  156. constant is added to the address of the variable.  You typically
  157. do this when the variable is the name of a memory array.
  158.                                                               8-4
  159.  
  160. Index Expressions
  161.  
  162. An index expression consists of a combination of a base register
  163. [BX] or [BP], and/or an index register [SI] or [DI], with an
  164. optional constant added or subtracted.   You will usually want to
  165. precede the bracketed expression with B, W, or D; to specify the
  166. kind of memory unit (byte, word, or doubleword) you are referring
  167. to.  The expression stands for the memory unit whose address is
  168. the run-time value(s) of the base and/or index registers added to
  169. the constant.  See the Effective Address section and the
  170. beginning of this chapter for more details on indexed memory.
  171.  
  172.  
  173. Descriptions of Operators and Specifiers
  174.  
  175. HIGH/LOW
  176.  
  177. Syntax:  HIGH  operand
  178.          LOW  operand
  179.  
  180. These operators are called the "byte isolation" operators.  The
  181. operand  must evaluate to a 16-bit number.   HIGH returns the
  182. high order byte of the number; LOW the low order byte.
  183.  
  184. For example,
  185.  
  186.   MOV AL,HIGH(01234)     ; AL = 012
  187.   TENHEX EQU LOW(0FF10)  ; TENHEX = 010
  188.  
  189. These operators can be applied to each other.   The following
  190. identities apply:
  191.  
  192. LOW LOW Q = LOW Q
  193. LOW HIGH Q = HIGH Q
  194. HIGH LOW Q = 0
  195. HIGH HIGH Q = 0
  196.  
  197. BY
  198.  
  199. Syntax:  operand   BY  operand
  200.  
  201. This operator is a "byte combination" operator.  It returns the
  202. word whose high byte is the left operand, and whose low byte is
  203. the right operand.  For example, the expression 3 BY 5 is the
  204. same as hexadecimal 0305.  The BY operator is exclusive to A86. I
  205. added it to cover the following situation: Suppose you are
  206. initializing your registers to immediate values.  Suppose you
  207. want to initialize AH to the ASCII value 'A', and AL to decimal
  208. 10.  You could code this as two instructions MOV AH,'A' and MOV
  209. AL,10; but you realize that a single load into the AX register
  210. would save both program space and execution time.  Without the BY
  211. operator, you would have to code MOV AX,0410A, which disguises
  212. the types of the individual byte operands you were thinking
  213. about.  With BY, you can code it properly: MOV AX,'A' BY 10.
  214.  
  215. Addition (combination)
  216.                                                               8-5
  217.  
  218. Syntax:  operand  +  operand
  219.          operand  .  operand
  220.          operand   PTR  operand
  221.          operand   operand
  222.  
  223. As shown in the above syntax, addition can be accomplished in
  224. four ways: with a plus sign, with a dot operator, with a PTR
  225. operator, and simply by juxtaposing two operands next to each
  226. other.  The dot and PTR operators are provided for compatibility.
  227. The dot is used in structure field notation; PTR is used in
  228. expressions such as BYTE PTR 0.  (See Chapter 12 for
  229. recommendations concerning PTR.)
  230.  
  231. If either operand is a constant, the answer is an expression with
  232. the typing of the other operand, with the offsets added.  For
  233. example, if BVAR is a byte variable, then BVAR + 100 is the byte
  234. variable 100 bytes beyond BVAR.
  235.  
  236. Other examples:
  237.  
  238.    DB 100+17         ; simple addition
  239.    CTRL EQU -040
  240.    MOV AL,CTRL'D'    ; a nice notation for control-D!
  241.    MOV DX,[BP].SMEM  ; --where SMEM was in an unindexed structure
  242.    DQ  10.0 + 7.0    ; floating point addition
  243.  
  244. Subtraction
  245.  
  246. Syntax:  operand  - operand
  247.  
  248. The subtraction operator may have operands that are:
  249.  
  250.   a. both absolute numbers
  251.  
  252.   b. variable names that have the same type
  253.  
  254. The result is an absolute number; the difference between the two
  255. operands.
  256.  
  257. Subtraction is also allowed between floating point numbers; the
  258. answer is the floating point difference.
  259.  
  260. Multiplication and Division
  261.  
  262. Syntax:   operand   * operand     (multiplication)
  263.           operand   / operand     (division)
  264.           operand   MOD operand   (modulo)
  265.  
  266. You may only use these operators with absolute or floating point
  267. numbers, and the result is always the same type.  Either operand
  268. may be a numeric expression, as long as the expression evaluates
  269. to an absolute or floating point number.  Examples:
  270.  
  271. CMP AL,2 * 4    ; compare AL to 8
  272. MOV BX,0123/16  ; BX = 012
  273. DT  1.0 / 7.0
  274.                                                               8-6
  275.  
  276. Shifting Operators
  277.  
  278. Syntax:  operand   SHR count   (shift right)
  279.          operand   SHL count   (shift left)
  280.          BIT count             (bit number)
  281.  
  282. The shift operators will perform a "bit-wise" shift of the
  283. operand.  The operand will be shifted "count" bits either to the
  284. right or the left.  Bits shifted into the operand will be set to
  285. 0.
  286.  
  287. The expression "BIT count" is equivalent to "1 SHL count"; i.e.,
  288. BIT returns the mask of the single bit whose number is "count".
  289. The operands must be numeric expressions that evaluate to
  290. absolute numbers.  Examples:
  291.  
  292. MOV BX, 0FACBH SHR 4   ; BX = 0FACH
  293. OR AL,BIT 6            ; AL = AL OR 040; 040 is the mask for bit 6
  294.  
  295. Logical Operators
  296.  
  297. Syntax:  operand   OR operand
  298.          operand   XOR operand
  299.          operand   AND operand
  300.          NOT operand
  301.  
  302. The logical operators may only be used with absolute numbers.
  303. They always return an absolute number.
  304.  
  305. Logical operators operate on individual bits.   Each bit of the
  306. answer depends only on the corresponding bit in the operand(s).
  307.  
  308. The functions performed are as follows:
  309.  
  310. 1.  OR: An answer bit is 1 if either or both of the operand bits
  311.     is 1.   An answer bit is 0 only if both operand bits are 0.
  312.  
  313. 2.  XOR: This is "exclusive OR."  An answer bit is 1 if the
  314.     operand bits are different; an answer bit is 0 if the operand
  315.     bits are the same.
  316.  
  317. 3.  AND: An answer bit is 1 only if both operand bits are 1.   An
  318.     answer bit is 0 if either or both operand bits are 0.
  319.  
  320. 4.  NOT: An answer bit is the opposite of the operand bit.   It
  321.     is 1 if the operand bit is 0; 0 if the operand bit is 1.
  322.  
  323.     Examples:
  324.  
  325. 11110000xB OR 00110011xB = 11110011xB
  326. 11110000xB XOR 00110011xB = 11000011xB
  327. 11110000xB AND 00110011xB = 00110000xB
  328. NOT 00110011xB = 11001100xB
  329.  
  330. Boolean Negation Operator
  331.  
  332. Syntax:  ! operand
  333.                                                               8-7
  334.  
  335. The exclamation-point operator, rather than reversing each
  336. individual bit of the operand, considers the entire operand as a
  337. boolean variable to be negated.  If the operand is non-zero (any
  338. of the bits are 1), the answer is 0.  If the operand is zero, the
  339. answer is 0FFFF.
  340.  
  341. Because ! is intended to be used in conditional assembly
  342. expressions (described in Chapter 11), there is also a special
  343. action when ! is applied to an undefined name: the answer is the
  344. defined value 0FFFF, meaning it is TRUE that the symbol is
  345. undefined.  Similarly, when ! is applied to some defined quantity
  346. other than an absolute constant, the answer is 0, meaning it is
  347. FALSE that the operand is undefined.
  348.  
  349. Relational Operators
  350.  
  351. Syntax:    operand   EQ operand    (equal)
  352.            operand   NE operand    (not equal)
  353.            operand   LT operand    (less than)
  354.            operand   LE operand    (less or equal)
  355.            operand   GT operand    (greater than)
  356.            operand   GE operand    (greater or equal)
  357.  
  358. The relational operators may have operands that are either both
  359. absolute numbers, or both variable names that have the same type.
  360. The result of a relational operation is always an absolute
  361. number.  They return an 8-or 16-bit result of all 1's for TRUE
  362. and all 0's for FALSE.  Examples:
  363.  
  364. MOV AL, 3 EQ 0     ; AL = 0 (false)
  365. MOV AX, 2 LE 15    ; AX = 0FFFFH (true)
  366.  
  367. String Comparison Operators
  368.  
  369. Syntax:    string   EQ string    (equal)
  370.            string   NE string    (not equal)
  371.            string   = string     (equal ignoring case)
  372.  
  373. In order to subsume the string comparison facilities offered by
  374. MASM's special conditional-assembly directives IFIDN and IFDIF,
  375. A86 allows the relational operators EQ and NE to accept string
  376. arguments.  For this syntax to be accepted by A86, both strings
  377. must be bounded using the same delimiter (either single quotes
  378. for both strings, or double quotes for both strings).  For a
  379. match (EQ returns TRUE or NE returns FALSE), the strings must be
  380. the same length, and every character must match exactly.
  381.                                                               8-8
  382.  
  383. An additional A86-exclusive feature is the = operator, which
  384. returns TRUE if the characters of the strings differ only in the
  385. bit masked by the value 020.  Thus you may use = to compare a
  386. macro parameter to a string containing nothing but letters.  The
  387. comparison will be TRUE whether the macro parameter is upper-case
  388. or lower-case.  No checking is made to detect non-letters, so if
  389. you use = on strings containing non-letters, you may get some
  390. false TRUE results.  Also, = is accepted when it is applied to
  391. non-strings as well-- the corresponding values are interpreted as
  392. two-byte strings, with the 020 bits masked away before
  393. comparison.
  394.  
  395. B,W,D,F,Q,T Memory Variable Specifiers
  396.  
  397. Syntax:  B  operand     D  operand      Q  operand
  398.          operand    B   operand    D    operand    Q
  399.          W  operand     F  operand      T  operand
  400.          operand    W   operand    F    operand    T
  401.  
  402. B, W, D, F, Q, and T convert the operand into a byte, word,
  403. doubleword, far, quadword, and ten-byte variable, respectively.
  404. The operand can be a constant, or a variable of the other type.
  405. Examples:
  406.  
  407. ARRAY_PTR:
  408.   DB 100 DUP (?)
  409. WVAR  DW ?
  410.   MOV AL,ARRAY_PTR B  ; load first byte of ARRAY_PTR array into AL
  411.   MOV AL,WVAR B       ; load the low byte of WVAR into AL
  412.   MOV AX,W[01000]     ; load AX with the memory word at loc. 01000
  413.   LDS BX,D[01000]     ; load DS:BX with the doubleword at loc. 01000
  414.   JMP F OUTSIDE_LOC   ; jump to undeclared far location OUTSIDE_LOC
  415.   FLD T[BX]           ; load ten-byte number at [BX] to 87 stack
  416.  
  417.  
  418. For compatibility, A86 accepts the more verbose synonyms BYTE,
  419. WORD, DWORD, FAR, QWORD, and TBYTE for B,W,D,F,Q,T, respectively.
  420.  
  421. SHORT and LONG Operators
  422.  
  423. Syntax:    SHORT label
  424.            LONG label
  425.  
  426. The SHORT operator is used to specify that the label referenced
  427. by a JMP instruction is within 127 bytes of the end of the
  428. instruction.  The LONG operator specifies the opposite: that the
  429. label is not within 127 bytes.  The appropriate operator can (and
  430. sometimes must) be used if the label is forward referenced in the
  431. instruction.
  432.  
  433. When a non-local label is forward referenced, the assembler
  434. assumes that it will require two bytes to represent the relative
  435. offset of the label (so the instruction including the opcode byte
  436. will be three bytes).  By correctly using the SHORT operator, you
  437. can save a byte of code when you use a forward reference. If the
  438. label is not within the specified range, an error will occur. The
  439. following example illustrates the use of the SHORT operator.
  440.                                                               8-9
  441.  
  442. JMP FWDLAB        ; three byte instruction
  443. JMP SHORT FWDLAB  ; two byte instruction
  444. JMP >L1           ; two byte instruction assumed for a local label
  445.  
  446. Because the assembler assumes that a forward reference local
  447. label is SHORT, you may sometimes be forced to override this
  448. assumption if the label is in fact not within 127 bytes of the
  449. JMP.  This is why LONG is provided:
  450.  
  451. JMP LONG >L9      ; three byte instruction
  452.  
  453. If you are bothered by this possibility, you can specify the +G
  454. switch, which causes A86 to pessimistically generate the three
  455. byte JMP for all forward references, unless specifically told not
  456. to, with SHORT.
  457.  
  458. NOTE that for A86, LONG will have effect only on the operand to
  459. an unconditional JMP instruction; not to conditional jumps.  That
  460. is because conditional jumps farther than 127 bytes are available
  461. only on the 386.  If you run into this problem, then chances are
  462. your code is getting out of control--time to rearrange, or to
  463. break off some of the intervening code into separate procedures.
  464. If you insist upon leaving the code intact, you can replace the
  465. conditional jump with an "IF cond JMP".
  466.  
  467. OFFSET Operator
  468.  
  469. Syntax:  OFFSET var-name
  470.  
  471. OFFSET is used to convert a variable into the constant pointer to
  472. the variable.  For example, if you have declared  XX DW ?, and
  473. you want to load SI with the pointer to the variable XX, you can
  474. code: MOV SI,OFFSET XX.  The simpler instruction MOV SI,XX moves
  475. the variable contents of XX into SI, not the constant pointer to
  476. XX.
  477.  
  478. NEAR Operator
  479.  
  480. Syntax:  NEAR operand
  481.  
  482. NEAR converts the operand to have the type of a code label, as if
  483. it were defined by appearing at the beginning of a program line
  484. with a colon after it.  NEAR is provided mainly for
  485. compatibility.
  486.  
  487. Square Brackets Operator
  488.  
  489. Syntax:  [operand ]
  490.  
  491. Square brackets around an operand give the operand a memory
  492. variable type.  Square brackets are generally used to enclose the
  493. names of base and index registers: BX, BP, SI, and DI.  When the
  494. size of the memory variable can be deduced from the context of
  495. the expression, square brackets are also used to turn numeric
  496. constants into memory variables.  Examples:
  497.                                                              8-10
  498.  
  499.   MOV B[BX+50],047  ; move imm value 047 into mem byte at BX+50
  500.   MOV AL,[050]      ; move byte at memory location 050 into AL
  501.   MOV AL,050        ; move immediate value 050 into AL
  502.  
  503. Colon Operator
  504.  
  505. Syntax:   constant  :  operand
  506.           segreg  :  operand
  507.           seg_or_group_name  :  operand
  508.  
  509. The colon operator is used to attach a segment register value to
  510. an operand.  The segment register value appears to the left of
  511. the colon; the rest of the operand appears to the right of the
  512. colon.
  513.  
  514. There are three forms to the colon operator.  The first form has
  515. a constant as the segment register value.  This form is used to
  516. create an operand to a far (inter-segment) JMP or CALL
  517. instruction.  An example of this is the instruction JMP 0FFFF:0,
  518. which jumps to the cold-boot reset location of the 86 processor.
  519.  
  520. The second form has a segment register name to the left of the
  521. colon.  This is the segment override form, provided for
  522. compatibility.  A86 will generate a segment override byte when it
  523. sees this form, unless the operand to the right of the colon
  524. already has a default segment register that is the same as the
  525. given override.
  526.  
  527. I prefer the more explicit method of overrides, exclusive to A86:
  528. simply place the segment register name before the instruction
  529. mnemonic.  For example, I prefer ES MOV AL,[BX] to MOV
  530. AL,ES:[BX].
  531.  
  532. The third form has a segment or group name before the colon.
  533. This form is handled in .OBJ mode when there is a group name
  534. before the colon, and an external symbol after.  In that case,
  535. the group override is necessary for the linker to produce correct
  536. code.  In other cases, the override is not necessary and is
  537. ignored by A86.
  538.  
  539. ST Operator
  540.  
  541. ST is ignored whenever it occurs in an expression.  It is
  542. provided for compatibility with Intel and IBM assemblers. For
  543. example, you can code FLD ST(0),ST(1), which will be taken by A86
  544. as FLD 0,1.
  545.  
  546. REF and DEF Operators
  547.  
  548. Syntax:    REF symbol
  549.            DEF symbol
  550.  
  551. The REF operator returns a value of TRUE if the operand is a
  552. symbol that has been referenced, false if it hasn't.  Appearance
  553. as an operand to another REF or DEF does not count as a
  554. reference.
  555.                                                              8-11
  556.  
  557. The DEF operator returns a value of TRUE if the operand has been
  558. defined previously in the assembly, false if it hasn't.
  559.  
  560. REF and DEF are most often used within parameters to an IF
  561. conditional-assembly construct.
  562.  
  563. TYPE Operator
  564.  
  565. Syntax:  TYPE operand
  566.  
  567. The TYPE operator returns 1 if the operand is a byte variable; 2
  568. if the operand is a word variable; 4 if the operand is a
  569. doubleword variable; 8 if the operand is a quadword variable; 10
  570. if the operand is a ten-byte variable; 0 if the operand is a
  571. constant, and the number of bytes allocated by the structure if
  572. the operand is a structure name (see STRUC in the next chapter).
  573.  
  574. A common usage of the TYPE operator is to represent the number of
  575. bytes of a named structure.  For example, if you have declared a
  576. structure named LINE (as described in the next chapter) that
  577. defines 82 bytes of storage, then two ways you might refer to the
  578. value symbolically are as follows:
  579.  
  580.   MOV CX,TYPE LINE     ; loads the size of LINE into CX
  581.   DB TYPE LINE DUP ?   ; allocates an area of memory for a LINE
  582.  
  583. THIS and $ Specifiers
  584.  
  585. THIS returns the value of the current location counter.  It is
  586. provided for compatibility.  The dollar sign $ is the more
  587. standard and familiar specifier for this purpose; it is
  588. equivalent to THIS NEAR.  THIS is typically used with the BYTE
  589. and WORD specifiers to create alternate-typed symbols at the same
  590. memory location:
  591.  
  592.      BVAR EQU THIS BYTE
  593.      WVAR  DW ?
  594.  
  595. I don't recommend the use of THIS.  If you wish to retain Intel
  596. compatibility, you can use the less verbose LABEL directive:
  597.  
  598.       BVAR LABEL BYTE
  599.       WVAR  DW ?
  600.  
  601. If you are not concerned with compatibility to lesser assemblers,
  602. A86 offers a variety of less verbose forms.  The most concise is
  603. DB without an operand:
  604.  
  605.       BVAR DB
  606.       WVAR DW ?
  607.  
  608. If this is too cryptic for you, there is always BVAR EQU B[$].
  609.                                                              8-12
  610.  
  611. Operator Precedence
  612.  
  613. Consider the expression 1 + 2 * 3.  When A86 sees this
  614. expression, it could perform the multiplication first, giving an
  615. answer of 1+6 = 7; or it could do the addition first, giving an
  616. answer of 3*3 = 9.  In fact, A86 does the multiplication first,
  617. because A86 assigns a higher precedence to multiplication than it
  618. does addition.
  619.  
  620. The following list specifies the order of precedence A86 assigns
  621. to expression operators. All expressions are evaluated from left
  622. to right following the precedence rules.  You may override this
  623. order of evaluation and precedence through the use of parentheses
  624. ( ).  In the example above, you could override the precedence by
  625. parenthesizing the addition: (1+2) * 3.
  626.  
  627. Some symbols that we have referred to as operators, are treated
  628. by the assembler as operands having built-in values.  These
  629. include $, and ST.  In a similar vein, a segment override term (a
  630. segment register name followed by a colon) is recorded when it is
  631. scanned, but not acted upon until the entire containing
  632. expression is scanned and evaluated.  The size operators B, W, D,
  633. F, Q, and T are also recorded and applied after scanning and
  634. evaluation.
  635.  
  636. If two operators are adjacent, the rightmost operator must have
  637. precedence; otherwise, parentheses must be used.  For example,
  638. the expression BIT ! 1 is illegal because the leftmost operator
  639. BIT has the higher precedence of the two adjacent operators BIT
  640. and "!".  You can code BIT (! 1).
  641.  
  642. --Highest Precedence--
  643.  
  644. 1.  Parenthesized expressions
  645. 2.  Period
  646. 3.  OFFSET, SEG, TYPE, REF, DEF, and PTR
  647. 4.  HIGH, LOW, and BIT
  648. 5.  Multiplication and division: *, /, MOD, SHR, SHL
  649. 6.  Addition and subtraction: +,-
  650.        a. unary
  651.        b. binary
  652. 7.  Relational: EQ, NE, LT, LE, GT, GE =
  653. 8.  Logical NOT and !
  654. 9.  Logical AND
  655. 10. Logical OR and XOR
  656. 11. Colon for long pointer, SHORT, LONG, and BY
  657. 12. DUP
  658.  
  659. --Lowest Precedence--
  660.  
  661.